#include "SketchView.h"
#include "ToolManager.h"
#include "ToolBase.h"

SketchView::SketchView()
    : GraphicsView()
{
}

void
SketchView::mouseMoveEvent(QMouseEvent *event)
{
    m_activeTool = ToolManager::instance()->activeTool();
    if(m_activeTool != nullptr)
        m_activeTool->mouseMoveEvent(this, event);
    renderNow();
}

void
SketchView::mousePressEvent(QMouseEvent *event)
{
    m_activeTool = ToolManager::instance()->activeTool();
    if(m_activeTool != nullptr)
        m_activeTool->mousePressEvent(this, event);

    renderNow();
}

void
SketchView::mouseReleaseEvent(QMouseEvent *event)
{
    m_activeTool = ToolManager::instance()->activeTool();
    if(m_activeTool != nullptr)
        m_activeTool->mouseReleaseEvent(this, event);
    renderNow();
}
